package com.sgb.goods.widget.pop.adapter;

import android.content.Context;
import android.view.View;

import com.sgb.goods.BR;
import com.sgb.goods.R;
import com.sgb.goods.entity.ContractInfoEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

/**
 * 合同信息详情适配器
 * @author cyj
 */
public class ContractInfoDetailAdapter extends BaseRecycleAdapter<ContractInfoEntity.Records> {

    public ContractInfoDetailAdapter(Context context, List<ContractInfoEntity.Records> datas) {
        super(context, R.layout.goods_pop_item_contract_info_detail, datas);
    }

    @Override
    public void convert(ItemViewHolder holder, ContractInfoEntity.Records entity) {
        holder.setBinding(BR.entity, entity);
        if (holder.getLayoutPosition() == datas.size() - 1) {
            holder.setVisible(R.id.last_line, true);
        } else {
            holder.setVisible(R.id.last_line, false);
        }
        if (holder.getLayoutPosition() == 0) {
            holder.getView(R.id.line2).setVisibility(View.INVISIBLE);
        } else {
            holder.getView(R.id.line2).setVisibility(View.VISIBLE);
        }

    }
}
